<?php
include("form.php");
$sql="select  product_id, product_name, product_desc, price, product_cate
FROM product
join loai
WHERE product.category_id = loai.category_id";
$ketqua=mysql_query($sql);
if(!$ketqua or mysql_num_rows($ketqua)==0)
	{	
		echo "khong tim thay ban ghi nao!";
	}
else
	{
	$i==0;
		echo<<<OED
		<div align="center">
			<h3>DANH SACH CAC LOAI  SAN PHAM</h3>
			<table border="1" style="border-collapse:collapse;border-color:#336699">
				<tr>
					<th>Num</td>
					<th>Product_id</td>
					<th>Product_name</td>
					<th>Description</td>
					<th>Price</td>
					<th>Category</td>
					<th>Edit</td>
					<th>Delete</a></td>
				</tr>	
OED;
		while($dong=mysql_fetch_assoc($ketqua))
			{
				$i++;
				echo<<<EOD
				<tr>
					<td>{$i}</td>
					<td>{$dong["product_id"]}</td>
					<td>{$dong["product_name"]}</td>
					<td>{$dong["product_desc"]}</td>
					<td>{$dong["price"]}</td>
					<td>{$dong["product_cate"]}</td>
					<td><a href="sua.php?id={$dong["product_id"]}">Edit</a></td>
					<td><a href="xoa.php?id={$dong["product_id"]}">Delete</a></td>
					
				</tr>
				
EOD;
			}
echo"</table></div>";			

	}
?>